package indzcraft.loader;
import java.util.Arrays;
import java.util.HashMap;

public class GearBuffDB {
	
	private HashMap<Integer,GearBuff> gearBuffDB = new HashMap<Integer,GearBuff>();
	int[] ignorelist = new int[]{69210,46874,77950,65905,73526};
	int[] metagem_critdmg = new int[]{68778,76884};
	
	public GearBuffDB(){
		Arrays.sort(ignorelist);
		Arrays.sort(metagem_critdmg);
		populateDB();
	}
	
	public GearBuffDB.GearBuff getGearBuff(int id){
		if(gearBuffDB.containsKey(id)){
			return gearBuffDB.get(id);
		}
		//if(!(Arrays.binarySearch(ignorelist, id) >= 0))
		//	System.out.println("unknown gearbuffid:"+  id);
		return null;
	}
	
	public boolean isCritMetaGem(int id){
		if(Arrays.binarySearch(metagem_critdmg, id) >= 0){
			return true;
		}
		return false;
	}
	
	private void populateDB() {
		gearBuffDB.put(77979, new GearBuff("vial_of_shadows_lfr"));
		gearBuffDB.put(77207, new GearBuff("vial_of_shadows"));
		gearBuffDB.put(77999, new GearBuff("vial_of_shadows_heroic"));
		gearBuffDB.put(77945, new GearBuff("dagger_combat_buff")); // stage1
		gearBuffDB.put(77947, new GearBuff("dagger_combat_buff")); // stage2
		gearBuffDB.put(77949, new GearBuff("dagger_combat_buff")); // stage3
		gearBuffDB.put(68994, new GearBuff("matrix_restabilizer"));
		gearBuffDB.put(69150, new GearBuff("matrix_restabilizer_heroic"));
		gearBuffDB.put(72897, new GearBuff("arrow_of_time"));
		gearBuffDB.put(77197, new GearBuff("wrath_of_unchaining"));
		gearBuffDB.put(77994, new GearBuff("wrath_of_unchaining_heroic"));
		gearBuffDB.put(77974, new GearBuff("wrath_of_unchaining_lfr"));
		gearBuffDB.put(68927, new GearBuff("the_hungerer"));
		gearBuffDB.put(69112, new GearBuff("the_hungerer_heroic"));
		gearBuffDB.put(77202, new GearBuff("starcatcher_compass"));
		gearBuffDB.put(77993, new GearBuff("starcatcher_compass_heroic"));
		gearBuffDB.put(77973, new GearBuff("starcatcher_compass_lfr"));
		gearBuffDB.put(77188, new GearBuff("no_kaled"));
		gearBuffDB.put(78472, new GearBuff("no_kaled_heroic"));
		gearBuffDB.put(77113, new GearBuff("kiroptyric_sigil"));
		gearBuffDB.put(73648, new GearBuff("badge_of_conquest_403"));
		gearBuffDB.put(73643, new GearBuff("insignia_of_conquest"));
		
		// mop
		gearBuffDB.put(81125, new GearBuff("windswept_pages")); // item has heroic tag, but is the only item with this name
		gearBuffDB.put(89082, new GearBuff("hawkmasters_talon"));
		gearBuffDB.put(87079, new GearBuff("jade_bandit_figurine_heroic"));
		gearBuffDB.put(86043, new GearBuff("jade_bandit_figurine"));
		gearBuffDB.put(86772, new GearBuff("jade_bandit_figurine_lfr"));
		gearBuffDB.put(79328, new GearBuff("relic_of_xuen"));
		gearBuffDB.put(87495, new GearBuff("gerps_perfect_arrow"));
		gearBuffDB.put(86332, new GearBuff("terror_in_the_mists"));
		gearBuffDB.put(87167, new GearBuff("terror_in_the_mists_heroic"));
		gearBuffDB.put(86890, new GearBuff("terror_in_the_mists_lfr"));
		gearBuffDB.put(86132, new GearBuff("bottle_of_infinite_stars"));
		gearBuffDB.put(87057, new GearBuff("bottle_of_infinite_stars_heroic"));
		gearBuffDB.put(86791, new GearBuff("bottle_of_infinite_stars_lfr"));
		gearBuffDB.put(81265, new GearBuff("flashing_steel_talisman"));
		gearBuffDB.put(81267, new GearBuff("searing_words"));
		gearBuffDB.put(87574, new GearBuff("corens_cold_chromium_coaster"));
	}
	
	public HashMap<Integer, GearBuff> getAll(){
		return this.gearBuffDB;
	}

	public class GearBuff{
		private String name = "";
		
		public GearBuff(String n){
			name = n;
		}
		public void setName(String name) {
			this.name = name;
		}
		public String getName() {
			return name;
		}
	}
}

